package org.cainiao.basic.exception;

/**
 * <br />
 * <p>
 * Author: Cai Niao(wdhlzd@163.com)<br />
 */
public class ExceptionTest {

    /**
         stack=2, locals=2, args_size=2
             0: iload_1
             1: ifne          12
             4: new           #7                  // class org/cainiao/basic/exception/TestExc
             7: dup
             8: invokespecial #9                  // Method org/cainiao/basic/exception/TestExc."<init>":()V
             11: athrow
             12: return
     */
    public void cantBeZero(int i) throws TestExc {
        if (i == 0) {
            throw new TestExc();
        }
    }

    /**
         stack=2, locals=2, args_size=1
             0: aload_0
             1: iconst_2
             2: invokevirtual #10                 // Method cantBeZero:(I)V
             5: goto          17
             8: astore_1
             9: getstatic     #16                 // Field java/lang/System.out:Ljava/io/PrintStream;
             12: ldc           #22                 // String handleExc
             14: invokevirtual #24                 // Method java/io/PrintStream.println:(Ljava/lang/String;)V
             17: return
         Exception table:
             from    to  target type
             0     5     8   Class org/cainiao/basic/exception/TestExc
     */
    public void catchOne() {
        try {
            cantBeZero(2);
        } catch (TestExc e) {
            System.out.println("handleExc");
        }
    }
}
